#pragma once

#include "execution/util/execution_common.h"

namespace noisepage::execution::util::simd {

alignas(64) static constexpr const uint64_t K8_BIT_MATCH_LUT[256] = {
    0x0001020304050607ull, 0x0102030405060700ull, 0x0002030405060701ull, 0x0203040506070100ull, 0x0001030405060702ull,
    0x0103040506070200ull, 0x0003040506070201ull, 0x0304050607020100ull, 0x0001020405060703ull, 0x0102040506070300ull,
    0x0002040506070301ull, 0x0204050607030100ull, 0x0001040506070302ull, 0x0104050607030200ull, 0x0004050607030201ull,
    0x0405060703020100ull, 0x0001020305060704ull, 0x0102030506070400ull, 0x0002030506070401ull, 0x0203050607040100ull,
    0x0001030506070402ull, 0x0103050607040200ull, 0x0003050607040201ull, 0x0305060704020100ull, 0x0001020506070403ull,
    0x0102050607040300ull, 0x0002050607040301ull, 0x0205060704030100ull, 0x0001050607040302ull, 0x0105060704030200ull,
    0x0005060704030201ull, 0x0506070403020100ull, 0x0001020304060705ull, 0x0102030406070500ull, 0x0002030406070501ull,
    0x0203040607050100ull, 0x0001030406070502ull, 0x0103040607050200ull, 0x0003040607050201ull, 0x0304060705020100ull,
    0x0001020406070503ull, 0x0102040607050300ull, 0x0002040607050301ull, 0x0204060705030100ull, 0x0001040607050302ull,
    0x0104060705030200ull, 0x0004060705030201ull, 0x0406070503020100ull, 0x0001020306070504ull, 0x0102030607050400ull,
    0x0002030607050401ull, 0x0203060705040100ull, 0x0001030607050402ull, 0x0103060705040200ull, 0x0003060705040201ull,
    0x0306070504020100ull, 0x0001020607050403ull, 0x0102060705040300ull, 0x0002060705040301ull, 0x0206070504030100ull,
    0x0001060705040302ull, 0x0106070504030200ull, 0x0006070504030201ull, 0x0607050403020100ull, 0x0001020304050706ull,
    0x0102030405070600ull, 0x0002030405070601ull, 0x0203040507060100ull, 0x0001030405070602ull, 0x0103040507060200ull,
    0x0003040507060201ull, 0x0304050706020100ull, 0x0001020405070603ull, 0x0102040507060300ull, 0x0002040507060301ull,
    0x0204050706030100ull, 0x0001040507060302ull, 0x0104050706030200ull, 0x0004050706030201ull, 0x0405070603020100ull,
    0x0001020305070604ull, 0x0102030507060400ull, 0x0002030507060401ull, 0x0203050706040100ull, 0x0001030507060402ull,
    0x0103050706040200ull, 0x0003050706040201ull, 0x0305070604020100ull, 0x0001020507060403ull, 0x0102050706040300ull,
    0x0002050706040301ull, 0x0205070604030100ull, 0x0001050706040302ull, 0x0105070604030200ull, 0x0005070604030201ull,
    0x0507060403020100ull, 0x0001020304070605ull, 0x0102030407060500ull, 0x0002030407060501ull, 0x0203040706050100ull,
    0x0001030407060502ull, 0x0103040706050200ull, 0x0003040706050201ull, 0x0304070605020100ull, 0x0001020407060503ull,
    0x0102040706050300ull, 0x0002040706050301ull, 0x0204070605030100ull, 0x0001040706050302ull, 0x0104070605030200ull,
    0x0004070605030201ull, 0x0407060503020100ull, 0x0001020307060504ull, 0x0102030706050400ull, 0x0002030706050401ull,
    0x0203070605040100ull, 0x0001030706050402ull, 0x0103070605040200ull, 0x0003070605040201ull, 0x0307060504020100ull,
    0x0001020706050403ull, 0x0102070605040300ull, 0x0002070605040301ull, 0x0207060504030100ull, 0x0001070605040302ull,
    0x0107060504030200ull, 0x0007060504030201ull, 0x0706050403020100ull, 0x0001020304050607ull, 0x0102030405060700ull,
    0x0002030405060701ull, 0x0203040506070100ull, 0x0001030405060702ull, 0x0103040506070200ull, 0x0003040506070201ull,
    0x0304050607020100ull, 0x0001020405060703ull, 0x0102040506070300ull, 0x0002040506070301ull, 0x0204050607030100ull,
    0x0001040506070302ull, 0x0104050607030200ull, 0x0004050607030201ull, 0x0405060703020100ull, 0x0001020305060704ull,
    0x0102030506070400ull, 0x0002030506070401ull, 0x0203050607040100ull, 0x0001030506070402ull, 0x0103050607040200ull,
    0x0003050607040201ull, 0x0305060704020100ull, 0x0001020506070403ull, 0x0102050607040300ull, 0x0002050607040301ull,
    0x0205060704030100ull, 0x0001050607040302ull, 0x0105060704030200ull, 0x0005060704030201ull, 0x0506070403020100ull,
    0x0001020304060705ull, 0x0102030406070500ull, 0x0002030406070501ull, 0x0203040607050100ull, 0x0001030406070502ull,
    0x0103040607050200ull, 0x0003040607050201ull, 0x0304060705020100ull, 0x0001020406070503ull, 0x0102040607050300ull,
    0x0002040607050301ull, 0x0204060705030100ull, 0x0001040607050302ull, 0x0104060705030200ull, 0x0004060705030201ull,
    0x0406070503020100ull, 0x0001020306070504ull, 0x0102030607050400ull, 0x0002030607050401ull, 0x0203060705040100ull,
    0x0001030607050402ull, 0x0103060705040200ull, 0x0003060705040201ull, 0x0306070504020100ull, 0x0001020607050403ull,
    0x0102060705040300ull, 0x0002060705040301ull, 0x0206070504030100ull, 0x0001060705040302ull, 0x0106070504030200ull,
    0x0006070504030201ull, 0x0607050403020100ull, 0x0001020304050706ull, 0x0102030405070600ull, 0x0002030405070601ull,
    0x0203040507060100ull, 0x0001030405070602ull, 0x0103040507060200ull, 0x0003040507060201ull, 0x0304050706020100ull,
    0x0001020405070603ull, 0x0102040507060300ull, 0x0002040507060301ull, 0x0204050706030100ull, 0x0001040507060302ull,
    0x0104050706030200ull, 0x0004050706030201ull, 0x0405070603020100ull, 0x0001020305070604ull, 0x0102030507060400ull,
    0x0002030507060401ull, 0x0203050706040100ull, 0x0001030507060402ull, 0x0103050706040200ull, 0x0003050706040201ull,
    0x0305070604020100ull, 0x0001020507060403ull, 0x0102050706040300ull, 0x0002050706040301ull, 0x0205070604030100ull,
    0x0001050706040302ull, 0x0105070604030200ull, 0x0005070604030201ull, 0x0507060403020100ull, 0x0001020304070605ull,
    0x0102030407060500ull, 0x0002030407060501ull, 0x0203040706050100ull, 0x0001030407060502ull, 0x0103040706050200ull,
    0x0003040706050201ull, 0x0304070605020100ull, 0x0001020407060503ull, 0x0102040706050300ull, 0x0002040706050301ull,
    0x0204070605030100ull, 0x0001040706050302ull, 0x0104070605030200ull, 0x0004070605030201ull, 0x0407060503020100ull,
    0x0001020307060504ull, 0x0102030706050400ull, 0x0002030706050401ull, 0x0203070605040100ull, 0x0001030706050402ull,
    0x0103070605040200ull, 0x0003070605040201ull, 0x0307060504020100ull, 0x0001020706050403ull, 0x0102070605040300ull,
    0x0002070605040301ull, 0x0207060504030100ull, 0x0001070605040302ull, 0x0107060504030200ull, 0x0007060504030201ull,
    0x0706050403020100ull};

alignas(64) static constexpr const uint64_t K4_BIT_MATCH_LUT[16] = {
    0x0000000100020003ull, 0x0001000200030000ull, 0x0000000200030001ull, 0x0002000300010000ull,
    0x0000000100030002ull, 0x0001000300020000ull, 0x0000000300020001ull, 0x0003000200010000ull,
    0x0000000100020003ull, 0x0001000200030000ull, 0x0000000200030001ull, 0x0002000300010000ull,
    0x0000000100030002ull, 0x0001000300020000ull, 0x0000000300020001ull, 0x0003000200010000ull};

}  // namespace noisepage::execution::util::simd
